package com.espirit.common;

import java.io.File;

import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;

import com.espirit.eap.RevisionHistoryAware;
import com.espirit.eap.manager.RevisionHistory;

@Entity
public class RelatedFile implements RevisionHistoryAware{

	private Integer id;
	private File file;
	private String fileContentType;
	private String fileFileName;
	private String remark;
	
	private RevisionHistory revisionHistory; 
	
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	@Transient
	public File getFile() {
		return file;
	}

	public void setFile(File file) {
		this.file = file;
	}

	@Transient
	public String getFileContentType() {
		return fileContentType;
	}

	public void setFileContentType(String fileContentType) {
		this.fileContentType = fileContentType;
	}

	public String getFileFileName() {
		return fileFileName;
	}

	public void setFileFileName(String fileFileName) {
		this.fileFileName = fileFileName;
	}
	
	public void setRevisionHistory(RevisionHistory revisionHistory) {
		this.revisionHistory = revisionHistory;
	}
	
	@Embedded
	public RevisionHistory getRevisionHistory() {
		return revisionHistory;
	}
	@Override
	public RevisionHistory safeRevisionHistory() {
		if (revisionHistory == null) {
			revisionHistory = new RevisionHistory();
		}
		return revisionHistory;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}


}
